<template>
  <div class="feedback">
    <topbar class="mb10" right-text="发送" @click-right="onClickRight"></topbar>
    <van-cell-group>
      <van-field v-model="msg" rows="5" autosize type="textarea" placeholder="你的意见对我们至关重要！" />
    </van-cell-group>
  </div>
</template>
<style lang="less" scoped>
.feedback{
  .van-nav-bar__text {
    color: #ff0015;
    font-size: 16px;
  }
}
</style>
<script>
export default {
  data() {
    return {
      isApp: this.$store.state.auth.isApp,
      msg: ""
    };
  },
  mounted() {
    if(this.isApp){
      window.yangcheJS.setTitleBar(
              false,//是否隐藏导航栏
              "反馈",//页面标题
              "发送",//右上角文案
              "onClickRight()",//右上角js
              "refreshView",//返回上一级功能
              ""//导航栏颜色默认白色
      )
    }
  },
  methods: {
    onClickLeft() {
      history.go(-1);
    },
    onClickRight() {
      if(!this.msg){
        this.$toast('反馈内容不能为空')
        return;
      }
      $.post('//app.yangche51.com/6_1/usercenter/sysmessage/getfeedback_1_0.ashx',{
        content: this.msg
      }).then(res => {
        if(res.header.statusCode == 200){
          this.msg = '';
          this.$toast('反馈成功')
          history.go(-1)
        }
      })
      
    }
  }
};
</script>>